﻿<UserControl x:Class="SoftTeach.View.Stundenpläne.StundenplaneintragDetailView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" 
             d:DesignHeight="100" d:DesignWidth="200" >
  <UserControl.Resources>
    <Style x:Key="DisplayStyle">
      <Style.Triggers>
        <DataTrigger Binding="{Binding Path=IsDummy}" Value="True">
          <Setter Property="UIElement.Visibility" Value="Hidden"/>
        </DataTrigger>
        <DataTrigger Binding="{Binding Path=IsEditMode}" Value="False">
          <Setter Property="UIElement.Visibility" Value="Hidden"/>
        </DataTrigger>
      </Style.Triggers>
    </Style>
  </UserControl.Resources>

  <Border x:Name="SurroundBorder" BorderThickness="2" CornerRadius="3"
          MouseEnter="SurroundBorderMouseEnter" 
          MouseLeave="SurroundBorderMouseLeave"
          MouseLeftButtonDown="SurroundBorderMouseLeftButtonDown"
          Padding="0" DragOver="SurroundBorderDragOver"
          Drop="SurroundBorderDrop" 
          AllowDrop="True" 
          DragEnter="SurroundBorderDragEnter" 
          DragLeave="SurroundBorderDragLeave">
    <Border Background="{Binding Path=StundenplaneintragBackground}" CornerRadius="3">
      <!--<Border.BorderBrush>
      <SolidColorBrush x:Name="animatedBrush" Color="Transparent" />
    </Border.BorderBrush>-->
      <!--<Border.Triggers>
        <EventTrigger RoutedEvent="UIElement.MouseEnter">
          <BeginStoryboard>
            <Storyboard>
              <ColorAnimation Storyboard.TargetName="animatedBrush" Storyboard.TargetProperty="Color" To="#FF0000" Duration="0:0:0" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
        <EventTrigger RoutedEvent="UIElement.MouseLeave">
          <BeginStoryboard>
            <Storyboard>
              <ColorAnimation Storyboard.TargetName="animatedBrush" Storyboard.TargetProperty="Color" To="Transparent" Duration="0:0:0" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Border.Triggers>-->

      <Border.Triggers>
        <EventTrigger RoutedEvent="UIElement.MouseEnter">
          <BeginStoryboard>
            <Storyboard>
              <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" 
                                             Storyboard.TargetName="EditButtons" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
        <EventTrigger RoutedEvent="UIElement.MouseLeave">
          <BeginStoryboard>
            <Storyboard>
              <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" 
                                             Storyboard.TargetName="EditButtons" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Hidden</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Border.Triggers>
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" MinHeight="20"/>
          <RowDefinition Height="Auto" MinHeight="20"/>
        </Grid.RowDefinitions>
        <Label Grid.Row="0" Grid.Column="0" Padding="1" VerticalAlignment="Center" Content="{Binding Path=StundenplaneintragKlasse.KlasseBezeichnung}"/>
        <Label Grid.Row="0" Grid.Column="1" Padding="1" VerticalAlignment="Center" Content="{Binding Path=StundenplaneintragFach.FachBezeichnung}"/>
        <Border Grid.Row="0" Grid.Column="2" Style="{StaticResource DisplayStyle}">
          <StackPanel Orientation="Horizontal" Visibility="Hidden" HorizontalAlignment="Right" x:Name="EditButtons">
            <Button  Command="{Binding Path=EditStundenplaneintragCommand}">
              <Image Source="/SoftTeach;component/Images/Edit16.png"/>
            </Button>
            <Button Command="{Binding Path=RemoveStundenplaneintragCommand}">
              <Image Source="/SoftTeach;component/Images/Remove16.png"/>
            </Button>
          </StackPanel>
        </Border>
        <Label Grid.Row="1" Grid.Column="1" Padding="1" VerticalAlignment="Center"  Content="{Binding Path=StundenplaneintragRaum}"/>
      </Grid>
    </Border>
  </Border>
</UserControl>
